﻿
using System.Collections.Generic;
using Bridge.Base.Constructs;
namespace Pathfinder.Base.Constructs
{
    public class Damage : ChangableObject
    {
        public int DiceFace
        {
            get { return mDiceFace; }
            set { CheckPropertyChanged<int>("DiceFace", ref mDiceFace, ref value); }
        }

        public int DiceAmount
        {
            get { return mDiceAmount; }
            set
            {
                if (CheckPropertyChanged<int>("DiceAmount", ref mDiceAmount, ref value))
                {
                    NotifyPropertyChanged("DiceAmountString");
                }
            }
        }

        public string DiceAmountString
        {
            get { return mDiceAmount.ToString(); }
            set
            {
                int newDiceAmount = -1;
                if (int.TryParse(value, out newDiceAmount))
                {
                    DiceAmount = newDiceAmount;
                }
            }
        }

        public int FlatAmount
        {
            get { return mFlatAmount; }
            set
            {
                if (CheckPropertyChanged<int>("FlatAmount", ref mFlatAmount, ref value))
                {
                    NotifyPropertyChanged("FlatAmountString");
                }
            }
        }

        public string FlatAmountString
        {
            get { return mFlatAmount.ToString(); }
            set
            {
                int newFlatAmount = -1;
                if (int.TryParse(value, out newFlatAmount))
                {
                    FlatAmount = newFlatAmount;
                }
            }
        }

        public bool MultipliedOnCrit
        {
            get { return mMultipliedOnCrit; }
            set { CheckPropertyChanged<bool>("MultipliedOnCrit", ref mMultipliedOnCrit, ref value); }
        }

        public bool AppliedOnlyOnCrit
        {
            get { return mAppliedOnlyOnCrit; }
            set { CheckPropertyChanged<bool>("AppliedOnlyOnCrit", ref mAppliedOnlyOnCrit, ref value); }
        }

        public string DamageName
        {
            get { return mDamageName; }
            set { CheckPropertyChanged<string>("DamageName", ref mDamageName, ref value); }
        }

        public List<int> PossibleDamageDiceFace
        {
            get { return new List<int>() { 0, 2, 3, 4, 6, 8, 10, 12, 20 }; }
        }

        private int mDiceAmount = 0;
        private int mDiceFace = 0;
        private int mFlatAmount = 0;
        private string mDamageName = string.Empty;
        private bool mMultipliedOnCrit = true;
        private bool mAppliedOnlyOnCrit = false;
    }
}
